<?php 
/**
* @orm tableName oneToOneParent
*/
class DomArManyToManyTestClass extends DomArObject {
	
	/**
	* @orm text
	*/
	public $name;
	
	/**
	* @orm owns children DomArManyToManyChildTestClass inverse parents
	*/
	public $children;
	
	/**
	* @orm has children DomArManyToManyChildTestClass inverse aggrParents
	*/
	public $aggrChildren;
	
	/**
	* @orm has parents DomArManyToManyChildTestClass inverse children
	*/
	public $parents;
	
	public function construct( $name ) {
		$this->name = $name;
	}

}

/**
* @orm tableName oneToOneChild
*/
class DomArManyToManyChildTestClass extends DomArObject {

	/**
	* @orm text
	*/
	public $name;

	/**
	* @orm has parents DomArManyToManyTestClass inverse children
	*/
	public $parents;
	
	/**
	* @orm has parents DomArManyToManyTestClass inverse aggrChildren
	*/
	public $aggrParents;
	
	/**
	* @orm has children DomArManyToManyTestClass inverse parents
	*/
	public $children;
	
	public function construct( $name ) {
		$this->name = $name;
	}
}

/**
* @orm tableName oneToOneChild
*/
class DomArManyToManyChildExtTestClass extends DomArOneToOneChildTestClass {

}


class DomArManyToManyVChild extends DomArObject {
	
	/**
	 * @orm text
	 */
	public $text;
	/**
	* @orm has many DomArManyToManyVChild inverse parents myValidator()
	*/
	public $items;
	/**
	* @orm has parents DomArManyToManyVChild inverse items mySecondValidator()
	*/
	public $parents;
	
	public function myValidator( $value, &$customParams ) {
		if( $value->text == 'good') {
			return 0;
		} else {
			$customParams['myParam'] = $value->text;
			return 29;
		}
	}
	
	public function mySecondValidator( $value, &$customParams ) {
		if( $value->text != 'main') {
			$customParams['myValue'] = $value->text;
			return 31;
		} else
			return 0;
	}
	
	public function getValidationErrorMessages() {
		return array(
			'items' => array(
				29 => 'I My error [$myParam]',
				31 => 'I Only main is allowed, [$myValue] was given',
			),
			'parents' => array(
				29 => 'P My error [$myParam]',
				31 => 'P Only main is allowed, [$myValue] was given',
			),
		);
	}
	
}
?>